package com.id.coinscleaner.ram

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.get
import androidx.lifecycle.lifecycleScope
import com.id.coinscleaner.R
import com.id.coinscleaner.common.ViewBindingFragment
import com.id.coinscleaner.databinding.FragmentRamScanBinding
import com.id.coinscleaner.viewmodel.MemoryAndGameViewModel
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch


class RamScanFragment : ViewBindingFragment<FragmentRamScanBinding>() {
    val viewModel by lazy { ViewModelProvider(this.requireActivity()).get(MemoryAndGameViewModel::class.java) }
    override fun initView() {
        super.initView()
            binding.freeCompareAllRamTv.text = "${viewModel.usedStore}/${viewModel.allStore}"
            binding.usedRateTV.text = viewModel.rateStore
            binding.backIV.setOnClickListener {
                onBackPressed()
            }
        }

        override fun initEvent() {
            super.initEvent()
            lifecycleScope.launch {
                delay(3000)
                navigate(R.id.action_ramScanFragment_to_ramBoostFragment)
            }
        }

    }

